<?php

use App\Http\Controllers\Api\HomeController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});


Route::group(["prefix" => "/home"], function() {
    Route::get('/', [HomeController::class, "index"]);
});

// api routes
Route::get('/return-request-content', [HomeController::class, 'method1']);
Route::get('/throw-expected-error', [HomeController::class, 'method2']);
Route::get('/throw-unepxted-error', [HomeController::class, 'method3']);
Route::get('/return-s-query', [HomeController::class, 'method4']);

Route::fallback(function() {
    return error("no route match");
});